Previewing and Recording Captured Data
You can use sequence grabber components in two ways: to play digitized data for the user or to save captured data in a QuickTime movie. The process of displaying data that is to be captured is called
previewing
; saving captured data in a movie is called
recording
. You can use previewing to allow the user to prepare to make a recording. If you do so, your application can move directly from the preview operation to a record operation, without stopping the process.
Previewing
Previewing captured data involves playing that data for the user as it is captured. For video data, this means displaying the video images on the computer screen. For audio data, this means playing the sound through the computer's sound system. The following paragraphs outline the steps you must follow to preview captured data.
-
First, you must open a connection to the sequence grabber component. Use the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
Once you have a connection to a sequence grabber component, you must configure the component for the preview operation. Use the
SGSetGWorld
function (described on
SGSetGWorld
) to set the graphics world in which the preview is to be displayed. Allocate the appropriate channels by calling the
SGNewChannel
function (described on
SGNewChannel
). You must call this function once for each channel to be used by the sequence grabber component. Use the
SGSetChannelUsage
function (described on
SGSetChannelUsage
) to specify that each channel is to be used for previewing. You can then use the appropriate channel configuration functions to prepare the channel for the preview operation. For video channels, use the functions discussed in
"Working With Video Channels,"
. For sound channels, use the functions discussed in
"Working With Sound Channels,"
.
-
You start the preview operation by calling the
SGStartPreview
function (see
SGStartPreview
). The sequence grabber component then begins collecting data from the channels that you have created and plays that data appropriately. You can pause and restart the preview by calling the
SGPause
function (see
SGPause
). Use the
SGStop
function (see
SGStop
) to stop the preview. During the preview operation, be sure to call the
SGIdle
function (see
SGIdle
) frequently, so that the sequence grabber and its channels can perform the operation.
-
When you are done previewing, you can start recording or close your connection to the sequence grabber component. When you close the sequence grabber component, it automatically disposes of the channels you created.
See the sample program in
Listing 1
for an example of the preview operation.
Recording
During a record operation, a sequence grabber component collects the data it captures and formats that data into a QuickTime movie. During a record operation, the sequence grabber can also play the captured data for the user. However, the sequence grabber tries to prevent the playback from interfering with the quality of the recording process.
The following paragraphs discuss the steps you must follow to record captured data.
-
As with a preview operation, your application must establish a connection to a sequence grabber component. Use the Component Manager's
OpenDefaultComponent
or
OpenComponent
function.
-
Once you have a connection to a sequence grabber component, you must configure the component for the record operation. Use the
SGSetGWorld
function (see
SGSetGWorld
) to set the graphics world in which the data is to be displayed. Allocate the appropriate channels by calling the
SGNewChannel
function (see
SGNewChannel
). You must call this function once for each channel to be used by the sequence grabber component. Use the
SGSetChannelUsage
function (see
SGSetChannelUsage
) to specify that each channel is to be used for recording. At this time, you can specify whether the sequence grabber is to play that channel's data while recording. You can then use the appropriate channel configuration functions to prepare the channel for the record operation. For video channels, use the functions discussed in
"Working With Video Channels,"
. For sound channels, use the functions discussed in
"Working With Sound Channels,"
.
-
You must specify a movie file for use by the sequence grabber during the record operation. Use the
SGSetDataOutput
function (see
SGSetDataOutput
) to specify this movie file. This function also allows you to control whether the sequence grabber adds the movie resource to the movie file and whether it replaces existing data or appends the new movie to the file.
-
You can limit the amount of data that is captured during a record operation. The
SGSetMaximumRecordTime
function (see
SGSetMaximumRecordTime
) establishes a time limit for the record operation. The
SGSetChannelMaxFrames
function (see
SGSetChannelMaxFrames
) limits the number of frames of data that the sequence grabber collects from a specific channel.
-
You start the record operation by calling the
SGStartRecord
function (see
SGStartRecord
). The sequence grabber component then begins collecting data from the channels you have created, stores the data in a QuickTime movie, and, optionally, plays that data appropriately. You can pause and restart the record process by calling the
SGPause
function (see
SGPause
). During the record operation, be sure to call the
SGIdle
function (see
SGIdle
) frequently, so that the sequence grabber and its channels can perform the operation. Use the
SGStop
function (see
SGStop
) to stop recording. At this time, the sequence grabber saves the movie in your movie file, if you have chosen to do so.
-
When you are done recording, you can go back to previewing or close your connection to the sequence grabber component. When you close the sequence grabber component, it automatically disposes of the channels you created as well as any movies it has created.
© 1999 Apple Computer, Inc.Previous | Overview | Contents | Next